package com.ziyun.pop.modules.erpOrderLog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ziyun.pop.common.utils.UserUtils;
import org.springframework.stereotype.Service;
import java.util.Map;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import com.ziyun.pop.modules.erpOrderLog.dao.ErpOrderLogDao;
import com.ziyun.pop.modules.erpOrderLog.entity.ErpOrderLogEntity;
import com.ziyun.pop.modules.erpOrderLog.service.ErpOrderLogService;


@Service("erpOrderLogService")
public class ErpOrderLogServiceImpl extends ServiceImpl<ErpOrderLogDao, ErpOrderLogEntity> implements ErpOrderLogService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<ErpOrderLogEntity> page = (Page<ErpOrderLogEntity>) this.page(
                new Query<ErpOrderLogEntity>(params).getPage(),
                new QueryWrapper<ErpOrderLogEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public void insertOrderItemLog(String orderNo, Long relId, String logText) {
        ErpOrderLogEntity erpOrderLogEntity = new ErpOrderLogEntity(orderNo, relId, logText, UserUtils.getCurentUser());
        baseMapper.insert(erpOrderLogEntity);
    }

}
